#CHART_REPO := http://jenkins-chartmuseum:8080
OS := $(shell uname)
NAME := $(FILE_NAME)
preview: 
ifeq ($(OS),Darwin)
	sed -i "" -e "s/version:.*/version: $(PREVIEW_VERSION)/" Chart.yaml
	sed -i "" -e "s/version:.*/version: $(PREVIEW_VERSION)/" ../*/Chart.yaml
	sed -i "" -e "s/tag: .*/tag: $(PREVIEW_VERSION)/" values.yaml
	sed -i -e "s/existingClaim:.*/existingClaim: $(NAMESPACE)-pvc/" values.yaml
else ifeq ($(OS),Linux)
	sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" Chart.yaml
	sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" ../*/Chart.yaml
	sed -i -e "s|repository:.*|repository: $(DOCKER_REGISTRY)\/$(ORG)\/$(NAME)|" values.yaml
	sed -i -e "s/tag:.*/tag: $(PREVIEW_VERSION)/" values.yaml
	sed -i -e "s/existingClaim:.*/existingClaim: $(NAMESPACE)-pvc/" values.yaml
else
	echo "platfrom $(OS) not supported to release from"
	exit -1
endif
	echo "  version: $(PREVIEW_VERSION)" >> requirements.yaml
	cat values.yaml
	helm init --client-only --stable-repo-url $(CHARTMUSEUM_REPO)
	#helm repo add chartmuseum $(CHARTMUSEUM_REPO)
	#helm repo remove local
	helm dependency build
	helm lint
	helm package . 
	#jx step helm build
